package com.csun.dsms.controller;

import com.csun.dsms.comment.core.utils.wrapper.WrapMapper;
import com.csun.dsms.comment.core.utils.wrapper.Wrapper;
import com.csun.dsms.model.vo.ServiceRecordVo;
import com.csun.dsms.model.vo.poor.PoorVo;
import com.csun.dsms.model.vo.project.ProjectVo;
import com.csun.dsms.service.DsmsServiceRecordService;
import com.github.pagehelper.PageInfo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/service/record")
public class DsmsServiceRecordController {

    @Resource
    private DsmsServiceRecordService dsmsServiceRecordServiceImpl;
    /*
     *特困人员服务进度查询
     * */
    @RequestMapping(value = "/query",method = RequestMethod.POST)
    public Wrapper serviceRecordQuery (@RequestBody ServiceRecordVo serviceRecordVo){
        List<ServiceRecordVo> serviceRecordVos = dsmsServiceRecordServiceImpl.serviceRecordQuery(serviceRecordVo);
        return WrapMapper.wrap(Wrapper.SUCCESS_CODE,Wrapper.SUCCESS_MESSAGE,new PageInfo<>(serviceRecordVos));
    }

    /*
     * 特困人员服务进度详情查询
     * */
    @RequestMapping(value = "/queryById",method = RequestMethod.POST)
    public Wrapper serviceRecordQueryById(@RequestBody ServiceRecordVo serviceRecordVo){
        PoorVo poorVo = dsmsServiceRecordServiceImpl.queryServiceProject(serviceRecordVo);
        return WrapMapper.wrap(Wrapper.SUCCESS_CODE,Wrapper.SUCCESS_MESSAGE,poorVo);
    }

    /*
     * 网格月服务进度查询
     * */
    @RequestMapping(value = "/queryByArea",method = RequestMethod.POST)
    public Wrapper serviceRecordQueryByArea(@RequestBody ServiceRecordVo serviceRecordVo){
        List<ServiceRecordVo> serviceRecordVos = dsmsServiceRecordServiceImpl.serviceRecordQueryByArea(serviceRecordVo);
        return WrapMapper.wrap(Wrapper.SUCCESS_CODE,Wrapper.SUCCESS_MESSAGE,new PageInfo<>(serviceRecordVos));
    }

    /*
     * 网格日服务进度查询
     * */
    @RequestMapping(value = "/queryByDay",method = RequestMethod.POST)
    public Wrapper serviceRecordQueryByDay(@RequestBody ServiceRecordVo serviceRecordVo){
        List<ServiceRecordVo> serviceRecordVos = dsmsServiceRecordServiceImpl.serviceRecordQueryByDay(serviceRecordVo);
        return WrapMapper.wrap(Wrapper.SUCCESS_CODE,Wrapper.SUCCESS_MESSAGE,new PageInfo<>(serviceRecordVos));
    }

    /**
     * 月服务进度详情查看
      * @param serviceRecordVo
     * @return null
     * @author HD
     * @date 2022/2/14 14:32
     */
    @PostMapping(value = "/serviceRecordInfoByArea")
    public Wrapper serviceRecordInfoByArea(@RequestBody ServiceRecordVo serviceRecordVo){
        List<ProjectVo> serviceRecordVos = dsmsServiceRecordServiceImpl.serviceRecordInfoByArea(serviceRecordVo);
        return WrapMapper.wrap(Wrapper.SUCCESS_CODE,Wrapper.SUCCESS_MESSAGE,serviceRecordVos);
    }

    /**
     * 日服务进度详情查询
      * @param serviceRecordVo
     * @return null
     * @author HD
     * @date 2022/2/16 10:03
     */
    @PostMapping(value = "/serviceRecordInfoByDay")
    public Wrapper serviceRecordInfoByDay(@RequestBody ServiceRecordVo serviceRecordVo){
        List<ServiceRecordVo> serviceRecordVos = dsmsServiceRecordServiceImpl.serviceRecordInfoByDay(serviceRecordVo);
        return WrapMapper.wrap(Wrapper.SUCCESS_CODE,Wrapper.SUCCESS_MESSAGE,serviceRecordVos);
    }
}
